// pages/mysale/mysale.js
const app = getApp();
var router = require("../../router.js");
Page({    
  /**
   * 页面的初始数据
   */
  data: {
    gradeList: [
      '普通会员',
      'VIP会员',
      '黄金VIP会员'
    ]
  },
  go_team(){
    wx.navigateTo({
      url: './my_sale_team/my_sale_team',
    })
  },
  go_code(){
    wx.navigateTo({
      url: './my_code/my_code',
    })
  },
  to_get_cash() {
    wx.navigateTo({
      url: './get_cash/get_cash'
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    app.request({
      url: router.user.info,
      method: "POST",
      data: {
        userId: wx.getStorageSync('userInfo').id, 
      },
      success: function (data) {    
        console.log(data)   
        if (data.status == true) {      
            that.setData({
              list: data.user_list,             
            });
            wx.setStorage({
              key: "user_qrcode",
              data: data.user_list.qrcode,
            });             
        } else {
          wx.showToast({
            title: '获取信息失败',
            icon: 'none',
            mask: true,
            duration: 2000
          });
        }
      }
    })
  }
})